/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package reyes.mysite.dao;

import javax.jdo.PersistenceManager;

/**
 *
 * @author reyesyang
 */
public class DAO {
    private PersistenceManager pm = null;

    public DAO(){
        pm=PMF.get().getPersistenceManager();
    }

    public PersistenceManager getPM(){
        return pm;
    }

    public void closePM(){
        pm.close();
    }

    public void beginTransaction() {
        pm.currentTransaction().begin();
    }

    public void commitTransaction() {
        pm.currentTransaction().commit();
    }

    public void rollbackTransaction() {
        pm.currentTransaction().rollback();
    }

    public boolean isActiveTransaction() {
        return pm.currentTransaction().isActive();
    }

}
